﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TCOChart
{
    public partial class NavigationBarForm : Form
    {
        public NavigationBarForm()
        {
            InitializeComponent();
        }

        private void NavigationBarForm_Load(object sender, EventArgs e)
        {
            // DropDown
            dropdown1.Items.AddRange(new AntdUI.SelectItem[] {
                new AntdUI.SelectItem("code item"),
                new AntdUI.SelectItem("menu1")
                {
                    Sub = new List<object>
                    {
                        new AntdUI.SelectItem("item1"){ 
                            Online = 1
                        },
                        new AntdUI.SelectItem("item2"){ 
                            Online= 0
                        },
                    }
                },
                new AntdUI.SelectItem("menu2")
                {
                    Sub = new List<object>
                    {
                        "item1", "item2", "item3",
                    }
                },
                });
        }

        #region BreadCrumb
        private void button1_Click(object sender, EventArgs e)
        {
            AntdUI.BreadcrumbItem breadcrumbItem = new AntdUI.BreadcrumbItem()
            {
                Text = "add" + (breadcrumb1.Items.Count + 1),

            };
            breadcrumb1.Items.Add(breadcrumbItem);
        }

        private void breadcrumb1_ItemClick(object sender, AntdUI.BreadcrumbItemEventArgs e)
        {
            int end = breadcrumb1.Items.Count - 1;
            AntdUI.BreadcrumbItem curItem = e.Item;
            int curIndex = breadcrumb1.Items.IndexOf(curItem);
            breadcrumb1.Items.RemoveRange(curIndex+1, end - curIndex);  // 删除curIndex+1位置开始end - curIndex个元素
        }
        #endregion

        #region DropDown
        private void dropdown1_SelectedValueChanged(object sender, AntdUI.ObjectNEventArgs e)
        {
            AntdUI.Message.info(this, $"点击了-{e.Value}", autoClose:3);
        }

        #endregion

        #region Steps
        private void steps1_ItemClick(object sender, AntdUI.StepsItemEventArgs e)
        {
            int curIndex = steps1.Items.IndexOf(e.Item);
            steps1.Current = curIndex;
            steps1.Status = AntdUI.TStepState.Error;
        }
        #endregion

        
    }
}
